package MaintMenu.PoAnalysis;// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   DnkFunctions.java

import java.util.Calendar;

public class DnkFunctionslt {

    public DnkFunctionslt() {
        cal = Calendar.getInstance();
    }

    public String comparePrice(double gn, double depo, double tyg_tx, double ks, double tyg_tw, double gd, String supplier) {
        double bestPrice = 9999D;
        String bestCompany = "null";
        if (gn > 0.0D && gn < bestPrice) {
            bestPrice = gn;
            bestCompany = "gn";
        }
        if (depo > 0.0D && depo < bestPrice) {
            bestPrice = depo;
            bestCompany = "depo";
        }
        if (tyg_tx > 0.0D && tyg_tx < bestPrice) {
            bestPrice = tyg_tx;
            bestCompany = "tyg_tx";
        }
        if (ks > 0.0D && ks < bestPrice) {
            bestPrice = ks;
            bestCompany = "ks";
        }
        if (tyg_tw > 0.0D && tyg_tw * 1.2D < bestPrice) {
            bestPrice = tyg_tw * 1.2D;
            bestCompany = "tyg_tw";
        }
        if (gd > 0.0D && gd * 1.2D < bestPrice) {
            bestPrice = gd * 1.2D;
            bestCompany = "gd";
        }
        return bestCompany;
    }

    public int getCategoryID(String arg) {
        int ctg = 0;
        if (arg.equals("BC"))
            ctg = 1;
        else if (arg.equals("HF"))
            ctg = 2;
        else if (arg.equals("LT"))
            ctg = 3;
        else if (arg.equals("CL"))
            ctg = 4;
        else if (arg.equals("MR"))
            ctg = 5;
        else if (arg.equals("OT"))
            ctg = 6;
        return ctg;
    }

    public int getNeed(int arg) {
        int need = 0;
        if (arg >= 170)
            need = 7;
        else if (arg >= 160)
            need = 6;
        else if (arg >= 130)
            need = 5;
        else if (arg >= 100)
            need = 4;
        else if (arg >= 70)
            need = 3;
        else if (arg >= 21)
            need = 2;
        else if (arg >= 10)
            need = 1;
        else
            need = 0;
        return need;
    }

    public int getNeed1(int arg, int byr, int eyr, int n, int t3msl) {
        int need = 0;
        int year1 = cal.get(1);
        if (arg >= 170)
            need = 7;
        else if (arg >= 160)
            need = 6;
        else if (arg >= 130)
            need = 5;
        else if (arg >= 85)
            need = 4;
        else if (arg >= 40)
            need = 3;
        else if (arg >= 31)
            need = t3msl <= Math.round(arg / 4) ? 2 : Math.round(t3msl / 3);
        else if (arg >= 21)
            need = t3msl <= Math.round(arg / 4) ? 1 : Math.round(t3msl / 3);
        else if (arg >= 16)
            need = 2;
        else if (arg >= 10)
            need = t3msl <= 4 ? 1 : 2;
        else if (arg >= 3)
            need = 1;
        else if (arg >= 2 && eyr > year1 - 5)
            need = 1;
        else if (arg >= 1 && eyr > year1 - 4 && n != 0)
            need = 1;
        else
            need = 0;
        return need;
    }

    Calendar cal;
}
